# 使用官方 Node.js 镜像作为基础镜像
FROM node:18

# 设置 taobao 镜像源
RUN npm config set registry https://registry.npmmirror.com
# RUN npm config set sharp_binary_host=https://registry.npmmirror.com/-/binary/sharp
# RUN npm config set sharp_libvips_binary_host=https://registry.npmmirror.com/-/binary/sharp-libvips
# RUN npm config set unsafe-perm true
# RUN apt-get update && apt-get install -y libvips-dev

# 安装 pnpm
# RUN npm install -g pnpm

# 设置工作目录
WORKDIR /app

# 复制 package.json 和 package-lock.json 文件
# COPY package.json package-lock.json

# 复制项目文件到工作目录
COPY . .

# 安装依赖
# RUN npm install sharp --ignore-scripts=false
# RUN npm install --platform=linux --arch=arm64 sharp
# RUN npm install @img/sharp-libvips-darwin-x64
RUN npm install
# RUN yarn

# 构建 Next.js 项目
# RUN pnpx prisma generate
# RUN npm run start:dev

# 暴露应用程序运行的端口
EXPOSE 5555

# 启动应用
CMD npm run start:dev
